package com.chenjun.core.service.activiti.impl;

import javax.annotation.Resource;

import org.activiti.engine.IdentityService;
import org.springframework.stereotype.Service;

import com.chenjun.core.dao.generator.entity.SysUserGroup;
import com.chenjun.core.service.activiti.SynUserGroupToActivitiService;

@Service
public class SynUserGroupToActivitiServiceImpl implements SynUserGroupToActivitiService {
	
	@Resource
	private IdentityService identityService;

	@Override
	public void addMembership(SysUserGroup record) {
		String userID = record.getUserId();
		String groupID = record.getGroupId();
		identityService.createMembership(userID, groupID);
	}

	@Override
	public void deleteMembership(SysUserGroup record) {
		String userID = record.getUserId();
		String groupID = record.getGroupId();
		identityService.deleteMembership(userID, groupID);
	}

}
